<template>
    <div v-show="isLoading" class="fixed_mode--container">
        <div class="loading"></div>
        <p>{{ $t('text.loading') }}</p>
    </div>
</template>

<script setup lang='ts'>
import EventEmiiter from '@/utils/EventEmiiter';
const isLoading = ref(false);
EventEmiiter.on('VIEW:CHANGE_LOADING',(loading:boolean)=>{
    isLoading.value = loading;
})
</script>
<style scoped lang='scss'>
.fixed_mode--container {
    z-index: 99999;
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;

    .loading {
        position: relative;
        width: 50px;
        perspective: 200px;
    }

    .loading:before,
    .loading:after {
        position: absolute;
        width: 20px;
        height: 20px;
        content: "";
        animation: jumping 0.5s infinite alternate;
        background: rgba(0, 0, 0, 0);
    }

    .loading:before {
        left: 0;
    }

    .loading:after {
        right: 0;
        animation-delay: 0.15s;
    }

    @keyframes jumping {
        0% {
            transform: scale(1) translateY(0px) rotateX(0deg);
            box-shadow: 0 0 0 rgba(0, 0, 0, 0);
        }

        100% {
            transform: scale(1.2) translateY(-25px) rotateX(45deg);
            background: #000;
            box-shadow: 0 25px 40px #000;
        }
    }
}
</style>